<template>
  <div id="home">
    <home-head/>
    <ul class="nav">
      <router-link
          to="/home/index"
          v-slot="{ href, route, navigate, isActive, isExactActive }"
          custom
      >
        <li
            :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
        >
          <a :href="href" @click="navigate">首页</a>
        </li>
      </router-link>
      <router-link
          to="/home/bookstore"
          v-slot="{ href, route, navigate, isActive, isExactActive }"
          custom
      >
        <li
            :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
        >
          <a :href="href" @click="navigate">书店区</a>
        </li>
      </router-link>
      <router-link
          to="/home/newbook"
          v-slot="{ href, route, navigate, isActive, isExactActive }"
          custom
      >
        <li
            :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
        >
          <a :href="href" @click="navigate">新书区</a>
        </li>
      </router-link>
      <router-link
          to="/home/booknotice"
          v-slot="{ href, route, navigate, isActive, isExactActive }"
          custom
      >
        <li
            :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
        >
          <a :href="href" @click="navigate">商城公告</a>
        </li>
      </router-link>
      <router-link
          to="/home/rule"
          v-slot="{ href, route, navigate, isActive, isExactActive }"
          custom
      >
        <li
            :class="[isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
        >
          <a :href="href" @click="navigate">借阅规则</a>
        </li>
      </router-link>
    </ul>

    <router-view/>
  </div>
</template>

<script>
import HomeHead from "../components/Home/HomeHead";
export default {
  name: 'Home',
  components: {
    HomeHead
  }
}
</script>
<style>
#home{
  width: 90%;
  margin: 0 auto;
}
.nav{
  display: flex;
  width: 100%;
  height: 50px;
  line-height: 50px;
  justify-content: space-between;
  text-align: center;
  margin-bottom: 10px;
}
.nav li{
  flex: 1;
}
.nav li a{
  display: block;
  text-decoration: none;
}
.nav li a:hover{
  background: orangered;
}
.router-link-active{
  border-bottom: 2px solid orangered;
  color: #ffffff;
}
</style>
